package site.tiangao.async.webflux;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.time.Duration;

@SpringBootApplication
public class WebfluxDemo {

    public static void main(String[] args) {
        SpringApplication.run(WebfluxDemo.class);
    }

    @RestController
    public static class BasicController {
        @GetMapping("/hello")
        public Mono<String> sayHelloWorld() {
            return Mono.just("Hello World").delayElement(Duration.ofMillis(100));
        }
    }
}
